/*****************************************************************************
 * $LastChangedDate: 2011-09-25 12:03:59 -0400 (Sun, 25 Sep 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Sound sample (SDL_mixer wave).
 *//*
 * LEGAL:   COPYRIGHT (C) 2009 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#if COMPILE_SDL_MIXER
#ifndef SOUND_SOUND_SAMPLE_SDL_WAVE_HH
#define SOUND_SOUND_SAMPLE_SDL_WAVE_HH 1

#include "sound/sound_sample.hh"

namespace sound {

////////////////////////////////////////////////////////////////////////////
/// @brief Sound sample (SDL_mixer wave).
///
class SampleSDLWave : public Sample
{
PREVENT_COPYING(SampleSDLWave)
public:
                    SampleSDLWave( const Sample::Name& sampleName, Mix_Chunk* mixChunk );
    virtual         ~SampleSDLWave();
    virtual bool    IfPlaying( void );
    virtual bool    Play( const defs::ePlayLoop loop, const fp volume );
    virtual bool    Stop( void );
    virtual bool    SetVolume( const fp volume );
    virtual fp      GetVolume( void );

private:
    bool            IfValidChannel( void ) { return mChannel != defs::SOUND_SDL_INVALID_CHANNEL; }

private:
    fp              mVolume;        ///< volume of this sample
    Mix_Chunk*      mMixChunk;      ///< SDL wave object
    int             mChannel;       ///< channel this sample will play on
};

} // namespace sound

#endif // SOUND_SOUND_SAMPLE_SDL_WAVE_HH
#endif // COMPILE_SDL_MIXER
